home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / Duchess.dxr / Internal_1_foundation cards.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  2.7 KB  |  98 lines

  1. property spriteNum, motion, undercard, row, location
  2. global getlist, equal, currentsel, godlist, foundation, points, tableau
  3.  
  4. on beginSprite me
  5.   row = determinerow()
  6.   undercard = sprite(spriteNum - 4)
  7.   location = sprite(spriteNum).loc
  8.   foundation.addProp(row, new(script("card pile")))
  9. end
  10.  
  11. on mouseDown me
  12.   if foundation[row].getcardcount() > 0 then
  13.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  14.     sprite(spriteNum).locZ = spriteNum + 1000
  15.     getlist = foundation[row]
  16.     if foundation[row].getcardcount() > 1 then
  17.       undercard.member = member(foundation[row].cards[foundation[row].getcardcount() - 1].membername, "playing cards")
  18.     else
  19.       if foundation[row].getcardcount() = 1 then
  20.         undercard.member = member("empty", "playing cards")
  21.       end if
  22.     end if
  23.     motion = timeout(string(spriteNum) && "motion").new(5, #moving, me)
  24.   end if
  25. end
  26.  
  27. on moving me
  28.   if the mouseDown then
  29.     sprite(spriteNum).loc = the mouseLoc
  30.   else
  31.     if the mouseUp then
  32.       sprite(spriteNum).locZ = spriteNum
  33.       motion.forget()
  34.       abort()
  35.     end if
  36.   end if
  37. end
  38.  
  39. on mouseUp me
  40.   if equal then
  41.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  42.     sprite(currentsel).member = member(sprite(spriteNum).member.name, "playing cards")
  43.     godlist.addCard(currentsel)
  44.     sprite(spriteNum).loc = location
  45.     foundation[row].cards.deleteOne(foundation[row].getlastcard())
  46.     if foundation[row].getcardcount() > 0 then
  47.       sprite(spriteNum).member = member(foundation[row].getlastcard().membername, "playing cards")
  48.     else
  49.       if foundation[row].getcardcount() = 0 then
  50.         sprite(spriteNum).member = member("empty", "playing cards")
  51.         undercard.member = member("empty", "playing cards")
  52.       end if
  53.     end if
  54.     if objectp(tableau[sprite(currentsel).row]) then
  55.       repeat with i = 93 to 96
  56.         if tableau[sprite(i).row].getcardcount() > 0 then
  57.           sprite(i).loc = tableau[sprite(i).row].getlastcard().location
  58.           next repeat
  59.         end if
  60.         sprite(i).loc = sprite(i).loki
  61.       end repeat
  62.     end if
  63.     if not objectp(foundation[sprite(currentsel).row]) then
  64.       points = points - 10
  65.     end if
  66.     equal = 0
  67.     currentsel = 0
  68.     godlist = VOID
  69.     getlist = VOID
  70.     checkwin()
  71.   else
  72.     if not equal then
  73.       puppetSound(3, member("drop card", "100GPak Generic SFX"))
  74.       getlist = VOID
  75.       sprite(spriteNum).loc = location
  76.     end if
  77.   end if
  78.   checkwin()
  79. end
  80.  
  81. on determinerow me
  82.   if spriteNum = 17 then
  83.     return #fone
  84.   else
  85.     if spriteNum = 18 then
  86.       return #ftwo
  87.     else
  88.       if spriteNum = 19 then
  89.         return #fthree
  90.       else
  91.         if spriteNum = 20 then
  92.           return #ffour
  93.         end if
  94.       end if
  95.     end if
  96.   end if
  97. end
  98.